package com.zhu.SupermarketInventoryManagement.controller;


import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/admin")
public class AdminListController {

    @GetMapping("/detail/{username}/{password}")
    public ModelAndView detail(@PathVariable String username, @PathVariable String password) {
        ModelAndView mav=new ModelAndView();
        mav.addObject("username",username);
        mav.addObject("password",password);
        mav.setViewName("/admin/detail");
        return mav;
    }
    @GetMapping("/update/{username}/{password}")
    public ModelAndView update(@PathVariable String username, @PathVariable String password) {
        ModelAndView mav=new ModelAndView();
        mav.addObject("username",username);
        mav.addObject("password",password);
        mav.setViewName("/admin/update");
        return mav;
    }


    @GetMapping("/add")
    public ModelAndView add() {
        ModelAndView mav=new ModelAndView();
        mav.setViewName("/admin/addAdmin");
        return mav;
    }
}
